package com.jspgou.cms.entity;

import java.util.HashSet;
import java.util.Set;

import com.jspgou.cms.entity.base.BaseAftersaleType;



public class AftersaleType extends BaseAftersaleType {
	private static final long serialVersionUID = 1L;

/*[CONSTRUCTOR MARKER BEGIN]*/
	public AftersaleType () {
		super();
	}

	/**
	 * Constructor for primary key
	 */
	public AftersaleType (java.lang.Long id) {
		super(id);
	}

	/**
	 * Constructor for required fields
	 */
	public AftersaleType (
		java.lang.Long id,
		java.lang.String name,
		boolean deliver) {

		super (
			id,
			name,
			deliver);
	}

/*[CONSTRUCTOR MARKER END]*/
	
	public Long[] getDemandIds() {
		Set<AftersaleDemand> set = getDemands();
		if (set == null) {
			return null;
		}
		Long[] demandIds = new Long[set.size()];
		int i = 0;
		for (AftersaleDemand tag : set) {
			demandIds[i++] = tag.getId();
		}
		return demandIds;
	}
	
	public void addToDemands(AftersaleDemand aftersaleDemand) {
		Set<AftersaleDemand> set =getDemands();
		if (set == null) {
			set = new HashSet<AftersaleDemand>();
			setDemands(set);
		}
		set.add(aftersaleDemand);
	}

}